home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / networ1a / whois.frm < prev    next >
Text File  |  1999-07-16  |  4KB  |  147 lines

  1. VERSION 5.00
  2. Object = "{FFACF7F3-B868-11CE-84A8-08005A9B23BD}#1.7#0"; "DSSOCK32.OCX"
  3. Begin VB.Form Form1 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "WhoIs Example"
  6.    ClientHeight    =   3885
  7.    ClientLeft      =   1140
  8.    ClientTop       =   1515
  9.    ClientWidth     =   5775
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    PaletteMode     =   1  'UseZOrder
  14.    ScaleHeight     =   3885
  15.    ScaleWidth      =   5775
  16.    ShowInTaskbar   =   0   'False
  17.    Begin VB.CommandButton Command1 
  18.       Caption         =   "Proccess Request"
  19.       Height          =   255
  20.       Left            =   2040
  21.       TabIndex        =   4
  22.       Top             =   3600
  23.       Width           =   1455
  24.    End
  25.    Begin VB.TextBox text2 
  26.       Height          =   285
  27.       Left            =   1920
  28.       TabIndex        =   2
  29.       Text            =   "hackers.com"
  30.       Top             =   0
  31.       Width           =   3855
  32.    End
  33.    Begin VB.TextBox Text1 
  34.       Height          =   3135
  35.       Left            =   0
  36.       MultiLine       =   -1  'True
  37.       ScrollBars      =   2  'Vertical
  38.       TabIndex        =   1
  39.       Top             =   360
  40.       Width           =   5775
  41.    End
  42.    Begin dsSocketLib.dsSocket dsSocket1 
  43.       Height          =   420
  44.       Left            =   4080
  45.       TabIndex        =   0
  46.       Top             =   3480
  47.       Width           =   420
  48.       _Version        =   65543
  49.       _ExtentX        =   741
  50.       _ExtentY        =   741
  51.       _StockProps     =   64
  52.       LocalPort       =   31337
  53.       RemoteHost      =   "whois.internic.net"
  54.       RemotePort      =   43
  55.       ServiceName     =   ""
  56.       RemoteDotAddr   =   ""
  57.       Linger          =   -1  'True
  58.       Timeout         =   10
  59.       LineMode        =   0   'False
  60.       EOLChar         =   10
  61.       BindConnect     =   0   'False
  62.       SocketType      =   0
  63.    End
  64.    Begin VB.Label Label1 
  65.       BackStyle       =   0  'Transparent
  66.       Caption         =   "Domain name to look up:"
  67.       Height          =   255
  68.       Left            =   0
  69.       TabIndex        =   3
  70.       Top             =   0
  71.       Width           =   1815
  72.    End
  73. End
  74. Attribute VB_Name = "Form1"
  75. Attribute VB_GlobalNameSpace = False
  76. Attribute VB_Creatable = False
  77. Attribute VB_PredeclaredId = True
  78. Attribute VB_Exposed = False
  79.  
  80. Dim lByteCount As Long
  81. Private Sub Command1_Click()
  82.  
  83.     '   use the whois server known as rs4.internic.net
  84.     
  85.     '   clear any previous query results first
  86.     Text1 = ""
  87.     '   clear the byte count
  88.     lByteCount = 0
  89.     dsSocket1.RemoteHost = "whois.internic.net"
  90.     '   whois servers await us on port 43  ;]
  91.     dsSocket1.RemotePort = 43
  92.     
  93.     '   well alrighty kids, its time to connect.
  94.     dsSocket1.Connect
  95.     
  96. End Sub
  97.  
  98. Private Sub dsSocket1_Connect()
  99. On Error Resume Next
  100.  
  101.     ' send the name of the domain we want to get
  102.     ' the info or what ever on.
  103.     dsSocket1.Send = Text2 & vbCrLf
  104.  
  105. End Sub
  106.  
  107. Private Sub dsSocket1_Exception(ErrorCode As Integer, ErrorDesc As String)
  108. MsgBox ErrorDesc
  109.  
  110. End Sub
  111.  
  112.  
  113. Private Sub dsSocket1_Receive(ReceiveData As String)
  114. On Error Resume Next
  115.  
  116.     Dim strData     As String
  117.     
  118.     '   save the incoming data
  119.     strData = ReceiveData
  120.     
  121.     '   count the bytes
  122.     lByteCount = lByteCount + Len(strData)
  123.     
  124.     '   the incoming data stream uses only LF characters
  125.     '   to denote a line wrap (ala Unix) so we'll precede
  126.     '   them with a CR so that the standard VB textbox will
  127.     '   wrap the lines correctly
  128.     While InStr(strData, Chr(10)) > 0
  129.         Text1 = Text1 & Left(strData, InStr(strData, Chr(10)) - 1) & Chr(13) & Chr(10)
  130.         strData = Mid(strData, InStr(strData, Chr(10)) + 1)
  131.     Wend
  132.     
  133.     '   if there's anything left then add it to the textbox
  134.     Text1 = Text1 & strData
  135.     
  136.     
  137.     dsSocket1.Close
  138.  
  139. End Sub
  140.  
  141.  
  142. Private Sub dsSocket1_SendReady()
  143.  
  144. End Sub
  145.  
  146.  
  147.